{% extends "base.html" %}
{% block title %}Tester's&nbsp;Paradise{% endblock%}
{% block css %}/static/styles/pages/detail.css{% endblock%}
{% block header %}
<script src="/static/js/jquery.js"></script>
<header class="header">
    <div class="header-cont">
        <a href="/" class="navbar-brand"><b>Tester's&nbsp;Paradise</b></a>
        <ul class="ant-menu ant-menu-light ant-menu-root ant-menu-horizontal" role="menu">
            {% if type == "video" %}
            <li class="ant-menu-submenu ant-menu-submenu-horizontal ant-menu-submenu-selected" role="menuitem">{% else
                %}
            <li class="ant-menu-submenu ant-menu-submenu-horizontal" role="menuitem">{% endif %}
                <div class="ant-menu-submenu-title" aria-expanded="false" aria-haspopup="true">
                    <a href="/sum/?type=video"><span class="ant-badge">视频测试结果</span>
                        <i class="ant-menu-submenu-arrow"></i></a>
                </div>
            </li>
            {% if type == "interface" %}
            <li class="ant-menu-submenu ant-menu-submenu-horizontal ant-menu-submenu-selected" role="menuitem">{% else
                %}
            <li class="ant-menu-submenu ant-menu-submenu-horizontal" role="menuitem">{% endif %}
                <div class="ant-menu-submenu-title" aria-expanded="false" aria-haspopup="true">
                    <a href="/sum/?type=interface"><span class="ant-badge">接口测试结果</span>
                        <i class="ant-menu-submenu-arrow"></i></a>
                </div>
            </li>

        </ul>
    </div>
</header>
{% endblock %}
{% block content %}
<script src="/static/js/test.js"></script>

<div class="page-main clearfix">
    <div style="justify-content: space-between; display: flex;">
        <p class="subtitle-summary">{% if type == "video" %}视频{% elif type == "interface" %}接口{% endif %}测试结果详情</p>
        <span class="verify_select">
            <select id="TypeId" class="select_result_type" style="height:36px; width:180px; background:white; color:grey;">
                <option>- 请选择测试结果类型 -</option>
                {% if condition == "1" %}<option value="1" selected="selected">通过</option>{% else %}<option value="1" >通过</option>{% endif %}
                {% if condition == "0" %}<option value="2" selected="selected">不通过</option>{% else %}<option value="2">不通过</option>{% endif %}
                {% if condition == "-1" %}<option value="3" selected="selected">未知</option>{% else %}<option value="3">未知</option>{% endif %}
            </select>
            {% if condition != "" %}
            <button id="select-{{ page }}" value="" onclick="selectEvents('{{ type }}', {{ sum_id }})" type="button" class="ant-btn ant-btn-primary" style="height:36px; width:59px; border-radius:6px; border:1px solid #a9a9a9; margin-left:4px; background: white;"><span>查询</span></button>
            {% else %}
            <button id="select-{{ page }}" value="{{ condition }}" onclick="selectEvents('{{ type }}', {{ sum_id }})" type="button" class="ant-btn ant-btn-primary" style="height:36px; width:59px; border-radius:6px; border:1px solid #a9a9a9; margin-left:4px; background: white;"><span>查询</span></button>
            {% endif %}
        </span>
    </div>
    <table>
        <thead class="ant-table-thead">
        <tr>
            <th class="ant-table-align-center" style="text-align: center;"><span class="ant-table-header-column"><div><span
                    class="ant-table-column-title">序号</span><span
                    class="ant-table-column-sorter"></span></div></span></th>
            <th class="ant-table-align-center" style="text-align: center;"><span class="ant-table-header-column"><div><span
                    class="ant-table-column-title">测试时间</span><span
                    class="ant-table-column-sorter"></span></div></span></th>
            <th class="ant-table-align-center" style="text-align: center;"><span class="ant-table-header-column"><div><span
                    class="ant-table-column-title">用例编号</span><span
                    class="ant-table-column-sorter"></span></div></span></th>
            <th class="ant-table-align-center" style="text-align: center;"><span class="ant-table-header-column"><div><span
                    class="ant-table-column-title">用例名称</span><span
                    class="ant-table-column-sorter"></span></div></span></th>
            <th class="ant-table-align-center" style="text-align: center;"><span class="ant-table-header-column"><div><span
                    class="ant-table-column-title">关键参数值比较结果</span><span
                    class="ant-table-column-sorter"></span></div></span></th>
            <th class="ant-table-align-center" style="text-align: center;"><span class="ant-table-header-column"><div><span
                    class="ant-table-column-title">结构完整性比较结果</span><span
                    class="ant-table-column-sorter"></span></div></span></th>
            <th class="ant-table-align-center" style="text-align: center;"><span class="ant-table-header-column"><div><span
                    class="ant-table-column-title">参数完整性比较结果</span><span
                    class="ant-table-column-sorter"></span></div></span></th>
            <th class="ant-table-align-center" style="text-align: center;"><span class="ant-table-header-column"><div><span
                    class="ant-table-column-title">特殊参数值比较结果</span><span
                    class="ant-table-column-sorter"></span></div></span></th>
            <th class="ant-table-align-center" style="text-align: center;"><span class="ant-table-header-column"><div><span
                    class="ant-table-column-title">请求时长</span><span
                    class="ant-table-column-sorter"></span></div></span></th>
            <th class="ant-table-align-center" style="text-align: center;"><span class="ant-table-header-column"><div><span
                    class="ant-table-column-title">用例测试结果</span><span
                    class="ant-table-column-sorter"></span></div></span></th>
        </tr>
        </thead>
        <tbody class="ant-table-tbody">
        {% for each in pagination_instance.items %}
        <tr class="ant-table-row ant-table-row-level-0">
            <td id="detail-id-{{ each.id }}" style="text-align: center;">{{ each.id }}</td>
            <td id="detail-test_datetime-{{ each.id }}" style="text-align: center;">2020-06-05 17:31:58</td>
            <td id="detail-case_number-{{ each.id }}" style="text-align: center;">{{ each.case_number }}</td>
            <td id="detail-interface_name-{{ each.id }}" style="text-align: center;">{{ each.interface_name }}</td>
            <td id="detail-return_code_compare_result-{{ each.id }}" style="text-align: center;">{% if each.return_code_compare_result == 1 %}pass{% elif each.return_code_compare_result == 0 %}fail{% endif %}</td>
            <td id="detail-structure_complete_compare_result-{{ each.id }}" style="text-align: center;">{% if each.structure_complete_compare_result == 1 %}pass{% elif each.structure_complete_compare_result == 0 %}fail{% endif %}</td>
            <td id="detail-param_complete_compare_result-{{ each.id }}" style="text-align: center;">{% if each.param_complete_compare_result == 1 %}pass{% elif each.param_complete_compare_result == 0 %}fail{% endif %}</td>
            <td id="detail-param_value_compare_result-{{ each.id }}" style="text-align: center;">{% if each.param_value_compare_result == 1 %}pass{% elif each.param_value_compare_result == 0 %}fail{% endif %}</td>
            <td id="detail-duration-{{ each.id }}" style="text-align: center;">{% if each.duration != None %}{{ each.duration }}{% endif %}</td>
            <td id="detail-test_result-{{ each.id }}" onclick="isCollapse('{{ each.id }}')">
                <div style="text-align: center; display: flex;">
                {% if each.return_code_compare_result == 0 or each.structure_complete_compare_result == 0 or each.param_complete_compare_result == 0 or each.param_value_compare_result == 0 %}
                <div style="width: 15px; height: 15px; border-radius: 50%; background: red; margin: auto;" title="不通过"></div><i id="iconfont-{{ each.id }}" class="iconfont" style="margin: 14px;">&#xe612;</i>
                {% elif each.return_code_compare_result == None and each.structure_complete_compare_result == None and each.param_complete_compare_result == None and each.param_value_compare_result == None %}
                <div style="width: 15px; height: 15px; border-radius: 50%; background: grey; margin: auto;" title="未测试"></div><i id="iconfont-{{ each.id }}" class="iconfont" style="margin: 14px;">&#xe612;</i>
                {% else %}
                <div style="width: 15px; height: 15px; border-radius: 50%; background: green; margin: auto;"></div><i id="iconfont-{{ each.id }}" class="iconfont" style="margin: 14px;">&#xe612;</i>
                {% endif %}
                </div>
            </td>
        </tr>
        <tr class="ant-table-row ant-table-row-level-0" id="test-detail-{{ each.id }}"
            title="{'request_method':'{{ each.request_method }}', 'request_url':'{{ each.request_url }}', 'request_params':'{{ each.request_params }}', 'return_code':{'return_code_to_compare':'{{ each.return_code_to_compare }}', 'actual_return_code':'{{ each.actual_return_code }}', 'expect_return_code':'{{ each.expect_return_code }}'}, 'param_complete':{'actual_params':'{{ each.actual_params }}', 'expect_params':'{{ each.expect_params }}'}, 'param_value':{'param_to_compare':'{{ each.param_to_compare }}', 'actual_param_value':'{{ each.actual_param_value }}', 'expect_param_value':'{{ each.expect_param_value }}'}}">
        </tr>
        </tbody>
        {% endfor %}
    </table>

    <ul class="ant-pagination ant-table-pagination">
        <li title="返回" class="ant-pagination-disabled ant-pagination-prev" aria-disabled="true" style="min-width: 40px; padding-left: 2px; padding-right: 2px;">
            <a href="/sum/?type={{ type }}" class="ant-pagination-item-link">返回</a>
        </li>

        {% if pagination_instance.has_prev %}
        <li title="上1页" class="ant-pagination-disabled ant-pagination-prev" aria-disabled="true">
            <a href="/detail/?type={{ type }}&sum_id={{ sum_id }}&page={{ pagination_instance.prev_num }}&condition={{ condition }}" class="ant-pagination-item-link"><</a>
        </li>
        {% endif %}

        {% for each in pages %}
        {% if each != None %}
            {% if each == page %}
        <li title="{{ each }}" class="ant-pagination-item ant-pagination-item-{{ each }} ant-pagination-item-active">
            <a href="/detail/?type={{ type }}&sum_id={{ sum_id }}&page={{ each }}&condition={{ condition }}">{{ each }}</a>
        </li>
            {% else %}
        <li title="{{ each }}" class="ant-pagination-item ant-pagination-item-{{ each }}" tabindex="0">
            <a href="/detail/?type={{ type }}&sum_id={{ sum_id }}&page={{ each }}&condition={{ condition }}">{{ each }}</a>
        </li>
            {% endif %}
        {% else %}
        <li id="more-{{ loop.index0 }}" title="更多" class="ant-pagination-jump-next ant-pagination-jump-next-custom-icon">
            <span class="ant-pagination-item-ellipsis" onclick="pageTurn({{ page }}, '{{ pages.index(page) < loop.index0 }}', {{ pagination_instance.pages }}, {{ sum_id }}, '{{ type }}')">&hellip;</span>
        </li>
        {% endif %}
        {% endfor %}

        {% if pagination_instance.has_next %}
        <li title="下1页" class="ant-pagination-disabled ant-pagination-prev" aria-disabled="true">
            <a href="/detail/?type={{ type }}&sum_id={{ sum_id }}&page={{ pagination_instance.next_num }}&condition={{ condition }}" class="ant-pagination-item-link">></a>
        </li>
        {% endif %}

    </ul>
</div>
{% endblock%}
